<template>
	<!-- 管理报名通告 -->
	<view>
		<!-- <uni-notice-bar color="#000" background-color="#fffbd7" single :text="NoticeMemo" v-if="isType == 0 " /> -->

		<scroll-view scroll-y @scrolltolower="onPullUpLoading()" :style="{ height: height + 'px' }">
			<view style="height: 100vh;display: flex;justify-content: center;align-items: center;"
				v-if="SignUpList.length == 0">
				暂无数据
			</view>
			<view v-else>
				<view
					style="padding: 20rpx;margin: 20rpx;background-color: #fff;border-radius: 5rpx;padding-bottom: 50rpx;"
					v-for="(item,index) in SignUpList" :key="index" @click="onNavDetail(item,index)">
					<view
						style="display: flex; flex-direction: row; justify-content: space-between; align-items: center;border-bottom: 1rpx solid #eeeeee;padding-bottom: 20rpx;">
						<view
							style="display: flex; flex-direction: row; justify-content: flex-start; align-items: center;">
							<image :src="item.WxHeadPic" style="width: 80rpx;height: 80rpx;border-radius: 50%;"
								mode="widthFix"></image>
							<view style="margin-left: 20rpx;">
								<view style="font-size: 26rpx;">
									<text>{{ item.NickName }}</text>
									<image :src="baseUrl + 'icon/boy.png'" mode="widthFix"
										style="width: 30rpx;height: 30rpx;"></image>
								</view>
								<view style="font-size: 22rpx; color: #cfcfcf;margin-top: 10rpx;">
									<!-- 其他 · 模特 · 舞者Dancer -->
									<text v-for="(itm, idx) in item.UserRoles" :key="idx">
										<text> {{ itm.LabelName }} </text>
										<text v-if="idx != (item.UserRoles.length - 1)"
											style="padding: 0 10rpx;">·</text>
									</text>
								</view>
							</view>
						</view>
						<view class="">
							<view style="text-align: right;font-size:26rpx;color: #54d5ff;"
								@click.stop="onContactHe(item.UserMobile)">
								联系她
							</view>
							<view style="font-size: 22rpx; margin-top: 10rpx; color: #cfcfcf;">
								{{ $common.timeDiff(item.addTime,new Date()) }}
							</view>
						</view>

					</view>
					<view style="margin-top: 20rpx;font-size: 24rpx;">
						报名理由：{{ item.SignupMemo }}
					</view>
				</view>
				<uni-load-more :status="more"></uni-load-more>
			</view>

		</scroll-view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				SignUpList: [],
				NoticeID: 0,
				isType: 0,
				page: 0,
				height: 0,
				more: 'more',
				// 通告
				NoticeMemo: '',
				baseUrl: ''
			}
		},
		onLoad(options) {
			this.baseUrl = this.$baseUrl;
			// console.log('options', options)
			this.isType = options.isType;
			if (options.isType == 0) {
				uni.setNavigationBarTitle({
					title: '管理通告管理'
				});
				this.NoticeID = options.NoticeID ? options.NoticeID : 0;
				this.getNoticeList()

			} else {
				uni.setNavigationBarTitle({
					title: '管理约单管理'
				});
				this.ReservationOrderID = options.ReservationOrderID ? options.ReservationOrderID : 0;
				this.getReservationOrderList()

			}
		},
		onShow() {
			this.height = uni.getSystemInfoSync().windowHeight - uni.upx2px(200);
		},
		methods: {
			onPullUpLoading() {
				this.page += 1;
				// console.log('this.isType', this.isType)
				// console.log('this.page', this.page)
				if (this.isType == 0) this.getNoticeList();
				if (this.isType == 1) this.getReservationOrderList();
			},
			onNavDetail(item, index) {
				if (this.isType == 0) {
					this.$common.goNavPage(
						`/myPages/pages/manageEntryDetail?NoticeID=${item.NoticeID}&SignupUserID=${item.SignupUserID}&isType=${this.isType}`
						)
				} else {
					this.$common.goNavPage(
						`/myPages/pages/manageEntryDetail?OrderSignupID=${item.OrderSignupID}&SignupUserID=${item.SignupUserID}&isType=${this.isType}`
						)
				}
			},
			// 打电话
			onContactHe(phone) {
				uni.makePhoneCall({
					phoneNumber: phone
				})
			},
			// 获取通告列表
			getNoticeList() {
				this.more = 'loading';
				this.$httpost('/Notices/NoticesSignUpList', {
					NoticeID: this.NoticeID,
					page: this.page
				}).then(res => {
					if (res.code == 200) {
						if (this.SignUpList.length != 0) {
							this.SignUpList = [...this.SignUpList, ...res.data];
							if (res.data.length == 0) this.more = 'onMore'
						} else {
							this.SignUpList = res.data;
							this.more = 'more'
						}
					}
				})
			},
			getReservationOrderList() {
				this.$httpost('/ReservationOrders/ReservationOrderSignUpList', {
					ReservationOrderID: this.ReservationOrderID,
					page: this.page
				}).then(res => {
					if (res.code == 200) {
						if (this.SignUpList.length != 0) {
							this.SignUpList = [...this.SignUpList, ...res.data];
							if (res.data.length == 0) this.more = 'onMore'
						} else {
							this.SignUpList = res.data;
							this.more = 'more'
						}
					}
				})
			}
		},

	}
</script>

<style>
</style>